<?php
/**
 * @link https://gitee.com/toshcn/yii2-oauth2-server
 * @copyright Copyright (c) 2018 len168.com
 * @license https://gitee.com/toshcn/yii2-oauth2-server/blob/master/LICENSE
 */

namespace toshcn\yii2\oauth2server\models;

use Yii;

/**
 * This is the model class for table "{{%oauth_jwt}}".
 *
 * @property string $client_id
 * @property string $subject
 * @property string $public_key
 */
class OauthJwt extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%oauth_jwt}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['client_id'], 'required'],
            [['client_id', 'subject'], 'string', 'max' => 80],
            [['public_key'], 'string', 'max' => 2000],
            [['client_id'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'client_id' => Yii::t('OauthJwt', 'Client ID'),
            'subject' => Yii::t('OauthJwt', 'Subject'),
            'public_key' => Yii::t('OauthJwt', 'Public Key'),
        ];
    }
}
